Skip to content

Commit

Permalink
update to 0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 committed Aug 31, 2019
1 parent 0a169d9 commit 3214db9
Show file tree
Hide file tree
Showing 315 changed files with 751 additions and 1,317 deletions.
27 changes: 12 additions & 15 deletions Readme.md
@@ -1,32 +1,29 @@
# OpenArkCompiler
# OpenArkCompiler

## 概述
-----------------
> 面向IoT、支持多语言多设备的新一代编译器
> 面向多设备、支持多语言的统一编程平台
OpenArkCompiler是来自华为方舟编译器的开源项目。

### OpenArkCompiler 四个技术点 ###
### OpenArkCompiler 四个技术特点 ###

通过将不同语言代码在开发环境中就编译成一套可执行文件,在运行环境中高效执行:
能够将不同语言代码编译成一套可执行文件,在运行环境中高效执行:
- 支持多语言联合优化、消除跨语言调用开销;
- 程序运行时无需依赖虚拟机,减少资源占用,具有高效内存回收机制;
- 可针对不同应用灵活编译优化;
- 开发者学习和使用成本低。

### 面向未来的智能硬件生态 ###
当前终端硬件的发展,有向智能IoT多样性发展的趋势,逐步形成以手机为中心,多设备互联互通的硬件形态;硬件多样性的发展,同时带来软件架构、编程框架的复杂性,上层应用及业务软件开发人员,急需一套编译框架,能够实现多种编程语言一次编译、多设备运行,并且具有良好的性能基础。方舟编译器基于上述硬件发展趋势、软件生态发展诉求,结合业界最新的编译器前沿技术,为软件开发人员打造多架构编程语言环境。
- 更轻量的语言运行时;
- 软硬协同充分发挥硬件能效;
- 支持多样化的终端设备平台

## 开源计划
**编译框架代码开源**
**编译器框架代码开源**
- 时间:2019年8月
- 开源范围:编译器IR+中端语言实现
- 开放能力:
- 框架开源供参考学习,了解方舟编译器架构及框架代码
- 开发者可构建出完整编译器工具链,支持Java Sample程序编译(非应用)

**后续开源范围**
陆续开源编译器前端、后端; 支持Java程序编译、JavaScript语言应用的编译等。
陆续开源编译器前端、后端、编译优化;完整支持Java程序编译、JavaScript语言应用的编译等。

**计划持续更新...**

Expand All @@ -35,9 +32,9 @@ OpenArkCompiler是来自华为方舟编译器的开源项目。
- 架构设计原理
- [MAPLE IR Design](doc/MapleIRDesign.md)
- [RC API](doc/RC_API.md)
- [朴素版RC操作插入原理](doc/Naive_RC_Principle.md)
- [虚函数表和接口函数表设计介绍](doc/Vtable&Itable.md)
- [Phase设计介绍](doc/Phase_Design.md)
- [Naive RC操作插入原理](doc/Naive_RC_Insertion_Description.md)
- [虚函数表和接口函数表设计介绍](doc/Vtable&Itable_Description.md)
- [Phase设计介绍](doc/Compiler_Phase_Description.md)

- [环境配置](doc/Development_Preparation.md)

Expand Down
2 changes: 1 addition & 1 deletion doc/Developer_Guide.md
Expand Up @@ -9,7 +9,7 @@

## 源码下载

下载地址:<https://code.opensource.huaweicloud.com/openarkcompiler/openarkcompiler/home>,可以通过`Clone` or `Download`的方式下载openarkcompiler源码
下载地址:<https://code.opensource.huaweicloud.com/HarmonyOS/OpenArkCompiler/home>,可以通过`Clone` or `Download`的方式下载openarkcompiler源码
> 注:默认源码下载目录为openarkcompiler

Expand Down
18 changes: 8 additions & 10 deletions doc/Development_Preparation.md
Expand Up @@ -10,23 +10,21 @@

## 开发环境推荐

推荐使用**Ubuntu 16.04 x86_64版本**
您需要安装一个64位版本的Ubuntu(推荐Ubuntu 16.04

开发环境推荐安装:

```
sudo apt-get -y install openjdk-8-jdk git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip lib32z1-dev qemu g++-multilib gcc-multilib python3-paramiko python-paramiko python-jenkins python-requests python-xlwt libglib2.0-dev libpixman-1-dev linux-libc-dev:i386
sudo apt-get -y install gcc-5-aarch64-linux-gnu g++-5-aarch64-linux-gnu
```


## 安装Clang编译器并完成配置
## 安装Clang编译器并完成配置(用于编译方舟编译器代码)

下载**clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04**
下载**clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04**
LLVM下载地址:http://releases.llvm.org/download.html#8.0.0

LLVM官方下载地址:<http://releases.llvm.org/download.html#8.0.0>

下载Clang编译器并放置到`openarkcompiler/tools`目录,打开`openarkcompiler/build/config/BUILDCONFIG.gn`文件,将`GN_C_COMPILER``GN_CXX_COMPILER``GN_AR`三个变量配置为Clang编译器所在路径,例如:
放置到`openarkcompiler/tools`目录,打开`openarkcompiler/build/config/BUILDCONFIG.gn`文件,将`GN_C_COMPILER``GN_CXX_COMPILER``GN_AR`三个变量配置为Clang编译器所在路径,例如:

```
GN_C_COMPILER = "${MAPLE_ROOT}/tools/clang_llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang"
Expand All @@ -38,9 +36,9 @@ GN_AR = "${MAPLE_ROOT}/tools/clang_llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/

## 安装Ninja、GN 并完成配置

下载**Ninja(v1.9.0)**,GitHub下载地址:<https://github.com/ninja-build/ninja/releases>

下载**GN(Linux Version)**,官方下载地址:<https://gn.googlesource.com/gn/>
下载**Ninja(v1.9.0)****GN(Linux Version)**
Ninja下载地址:https://github.com/ninja-build/ninja/releases
GN下载地址:https://archive.softwareheritage.org/browse/content/sha1_git:2dc0d5b26caef44f467de8120b26f8aad8b878be/raw/?filename=gn

将GN和Ninja可执行程序放置到openarkcompiler/tools目录,打开openarkcompiler/Makefile文件,将GN和NINJA两个变量配置为GN和Ninja可执行程序所在路径。例如:

Expand Down
16 changes: 8 additions & 8 deletions doc/MapleIRDesign.md
Expand Up @@ -1477,8 +1477,8 @@ callinstant &swap<{!UU=<$apair{!T=i32}>}> (         # &swap is instanti
C code:

```cpp
int foo(int i,int j{
return(i + j* -998;
int foo(int i,int j){
return(i + j)* -998;
}
```
Expand All @@ -1488,7 +1488,7 @@ Maple IR:
```cpp
func &foo (var %i i32, var %j i32) i32 {
return (
mul1 i32 (
mul i32 (
add i32 (dread i32 %i, dread i32 %j),
constval i32 -998))}
```
Expand All @@ -1501,8 +1501,8 @@ C source:
```cpp
float a[10];
void init(Void){
intI;
for(i=0;I<10;i++)
int I;
for(i=0; I<10; i++)
a[i]=i*3;
}
```
Expand All @@ -1511,7 +1511,7 @@ Maple IR:
```cpp
var $a <[10] f32>
func $init() void{
func &init() void{
var %i i32
dassign %i(constval i32 0)
while(
Expand Down Expand Up @@ -1545,7 +1545,7 @@ SS foo(SS x){
Maple IR:
```cpp
type $SS <struct@f1 i32, @f2:6 i8,@f3:2 i8}>
type $SS <struct {@f1 i32, @f2:6 i8,@f3:2 i8}>
func &foo (var %x <$SS>) <$SS> {
dassign %x 2 (constval i32 32 )
return (dread agg %x) }
Expand All @@ -1572,7 +1572,7 @@ Maple IR:
func &fact (var %n i32) i32 {
if (ne i32 (dread i32 %n, constval i32 1)) {
call $fact (sub i32 (dread i32 %n, constval i32 1))
return (mul i32 (dread i32 %nregread i32 %%retval))
return (mul i32 (dread i32 %n, regread i32 %%retval))
}
return(constval i32 1)
}
Expand Down
9 changes: 2 additions & 7 deletions license/Third_Party_Open_Source_Software_Notice.md
@@ -1,6 +1,6 @@
**OPEN SOURCE SOFTWARE NOTICE**
**OPEN SOURCE SOFTWARE NOTICE**

Please note we provide an open source software notice along with this product and/or this product firmware (in the following just “this product”). The open source software licenses are granted by the respective right holders. And the open source licenses prevail all other license information with regard to the respective open source software contained in the product, including but not limited to End User Software Licensing Agreement. This notice is provided on behalf of Huawei Technologies Co. Ltd. and any of its local subsidiaries which may have provided this product to you in your local country.
Please note we provide an open source software notice for the third party open source software along with this software and/or this software component contributed by Huawei (in the following just “this SOFTWARE”). The open source software licenses are granted by the respective right holders.

**Warranty Disclaimer **

Expand Down Expand Up @@ -96,8 +96,3 @@ distribution.



*foss@huawei.com*

detailing the name of the product and the firmware version for which you need the source code and indicating how we can contact you.

**This offer is valid for three years from the moment we distributed the product and valid for 3 years.**
2 changes: 1 addition & 1 deletion src/huawei_secure_c/include/securec.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.

This comment has been minimized.

Copy link
@findlayfeng

findlayfeng Aug 31, 2019

拼写错误 2333

This comment has been minimized.

Copy link
@Flipped-OvO

Flipped-OvO Aug 31, 2019

哈哈哈哈

*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/include/securectype.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/fscanf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/fwscanf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/gets_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/input.inl
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/memcpy_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/memmove_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/memset_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/output.inl
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/scanf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/secinput.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/securecutil.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/securecutil.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/secureinput_a.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/secureinput_w.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/secureprintoutput.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/secureprintoutput_a.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/secureprintoutput_w.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/snprintf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/sprintf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/sscanf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/strcat_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/strcpy_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/strncat_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/strncpy_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/strtok_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/swprintf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/swscanf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/vfscanf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down
2 changes: 1 addition & 1 deletion src/huawei_secure_c/src/vfwscanf_s.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reverved.
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
Expand Down

0 comments on commit 3214db9

Please sign in to comment.